package com.dsg.controller;
import com.dsg.entity.Staff;
import com.dsg.service.StaffService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {

    @Autowired
    private StaffService staffService;
    @GetMapping("/index")
    public String index(Model model){
        Subject subject = SecurityUtils.getSubject();
        Session session = subject.getSession();
        Staff staff = (Staff) subject.getPrincipal();
        session.setAttribute("staff",staff.getLoginId());
        return "index";
    }
}
